package cn.com.zpark;

import cn.com.zpark.bean.User;
import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;

/**
 * @PackageName: cn.com.zpark
 * @ClassName: JsonDemo03
 * @Description:
 * @author: RZS
 * @date: 2021/12/23  17:36
 */
public class JsonDemo03 {
    public static void main(String[] args) {
        User<String> user = new User<>();
        user.setName("zhangsan");

        List<String> list = new ArrayList<>();
        list.add("str");

        user.setList(list);

        // 创建json对象
        String s = JSON.toJSONString(user);
        System.out.println(s);
    }
}
